import {createRouter, createWebHistory} from 'vue-router';
import Layout from "@/views/Layout.vue";
import ArticleDetail from "@/views/ArticleDetail.vue";
import Article from "@/views/Article.vue";
import Collect from "@/views/Collect.vue";
import Like from "@/views/Like.vue";
import User from "@/views/User.vue";


const routes = [
    {
        path: '/',
        component: Layout,
        children: [
            {path: '/article', component: Article},
            {path: '/collect', component: Collect},
            {path: '/like', component: Like},
            {path: 'user', component: User}
        ],
        redirect: '/article'
    },
    {path: '/detail/:id', component: ArticleDetail}
];

const router = createRouter({
    history: createWebHistory(),
    routes,
    linkActiveClass: 'active', // 添加一个类名，用于表示当前路由的链接是模糊的
    linkExactActiveClass: 'exact-active' // 添加一个类名，用于表示当前路由的链接是精确匹配的
});

export default router;